package com.soft.controller;

import com.soft.pojo.Dept;
import com.soft.service.DeptService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ruoxi
 * @create 2021-12-28 11:32
 */
@WebServlet("/findDeptByDno")
public class FindDeptByDnoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int dno = Integer.parseInt(req.getParameter("dno"));
        DeptService deptService = new DeptService();

        Dept dept = deptService.findDeptByDno(dno);

        req.setAttribute("dept", dept);
        req.getRequestDispatcher("editDept.jsp").forward(req,resp);
    }
}
